package com.sunyzc.ebaotech.simulator.ybt.boc;

import com.sunyzc.ebaotech.simulator.ybt.AbstractYBTProcessor;

/**
 * 1001 - 保费试算 <br>
 * 1002 - 缴费出单 <br>
 * 1003 - 保单重打 <br>
 * 1004 - 当日撤单 <br>
 * 1005 - 续期缴费查询 <br>
 * - 续期缴费 <br>
 * 801 - 日结对账(801)(注意实际是没有对账请求的交易的) <br>
 */
public class BOCProcessor extends AbstractYBTProcessor {
	private final static int HEAD_LENGTH = 8;
	private final static int BODY_LENGTH_BEGIN_INDEX = 0;
	private final static int BODY_LENGTH_END_INDEX = 8;

	@Override
	public byte[] generateHeadBytes(String requestTransType, byte[] bodyContent) throws Exception {
		String requestHeadContent = String.format("%08d", bodyContent == null ? 0 : bodyContent.length);
		return requestHeadContent.getBytes(getClientConfig().getTransEncoding());
	}

	@Override
	protected int getHeadLength() {
		return HEAD_LENGTH;
	}

	@Override
	protected int getBodyLengthBeginIndex() {
		return BODY_LENGTH_BEGIN_INDEX;
	}

	@Override
	protected int getBodyLengthEndIndex() {
		return BODY_LENGTH_END_INDEX;
	}
}
